<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<pre>
from functools import wraps

class AuthClass:
    def __init__(self, name, pwd):
        self.name = name
        self.pwd = pwd

    def auth(self):
        if self.name == "Tesla" and self.pwd =="666":
            return True
        else:
            return False

user = AuthClass("Tesla", "888")

def auth_before(f):
    @wraps(f)
    def inner(*args, **kwargs):
        if not user.auth():
            print("用户名或密码错误")
            return False
        else:
            return f(*args, **kwargs)
    return inner

@auth_before
def p1():
    return "this is p1 function"

print(p1())
</pre>
</body>
</html>